{template header}
<script type="text/javascript" src="{WEBURLPATH}/javascript/picBox.js"></script>
<script type="text/javascript" charset="utf-8" src="{WEBURLPATH}/javascript/base64.js"></script>
<script language="javascript" type="text/javascript">

function checkpass(){
	var password = $('#password').val();
	var b = new Base64();
	var str = b.encode(password);
	$('#password').val(str);
	return false;
}
	
$(document).ready(function() {
	
	$("#companySortBox .leftNav li").hover(
		function(){
			$(this).addClass("current");
			$(this).find(".leftSubNav").css("top",$(this).index()*28+91);
			$(this).find(".leftSubNav").show();
		},
		function(){
			$(this).removeClass("current");
			$(this).find(".leftSubNav").hide();
		}
	);

	$('#slides').slides({
		preload: true,
		preloadImage: '{WEBURLPATH}/images/loading.gif',
		play: 5000,
		pause: 2500,
		hoverPause: true
	});

	var category = {};

	function getCategoryData(type) {
		var curCategory;
		for (key in category) {
			if (key == type) {
				curCategory = category[key];
				break;
			}
		}
		if (!curCategory) {
			$.post("{WEBURLPATH}/ajax.php", {"action": "category", "type" : type}, function(data){
				var strHtml = '<div class="default">';
				strHtml += '<a class="option option-active" data-value="0">[全部分类]</a>';
				strHtml += '</div>';
				for (key in data) {
					strHtml += '<dl><dt><a class="option" href="#" data-value="'+key+'">'+data[key].name+'</a></dt>';
					strHtml += '<dd><ul class="list-desc">';
					for (subkey in data[key].cell) {
						strHtml += '<li><a class="option" href="#" data-value="'+subkey+'">'+data[key].cell[subkey].name+'</a></li>';
					}
					strHtml += '</ul></dd></dl>';
				}
				$('#search_category .dp-option-wrap').html(strHtml);
				category[type] = data;
				bindSearchCategory();
			}, "json");
		} else {
			var strHtml = '<div class="default">';
			strHtml += '<a class="option option-active" data-value="0">[全部分类]</a>';
			strHtml += '</div>';
			for (key in curCategory) {
				strHtml += '<dl><dt><a class="option" href="#" data-value="'+key+'">'+curCategory[key].name+'</a></dt>';
				strHtml += '<dd><ul class="list-desc">';
				for (subkey in curCategory[key].cell) {
					strHtml += '<li><a class="option" href="#" data-value="'+subkey+'">'+curCategory[key].cell[subkey].name+'</a></li>';
				}
				strHtml += '</ul></dd></dl>';
			}
			$('#search_category .dp-option-wrap').html(strHtml);

			$('#search_category').find('.option').each(function(){
				$(this).click(function(){
					var text = $(this).html();
					text = text.replace(/(\[|\])/g, "");
					var data = $(this).attr('data-value');
					$('#search_category .option').removeClass('option-active');
					$(this).addClass('option-active');
					$('#category span').html(text);
					$('#category_id').val(data);
					$('#search_category').hide();
				});
			});
			bindSearchCategory();
		}
	}

	$('.searchA').click(function(){
		var id = $(this).attr('id');
		var popid = 'search_' + id;
		if ($('#' + popid).css('display') == 'block') {
			$('#' + popid).hide();
		} else {
			$('.pop-panel').hide();;
			$('#'+popid).show();
		}
	});

	$('#search_type').find('.option').each(function(){
		$(this).click(function(){
			var text = $(this).html();
			var data = $(this).attr('data-value');
			if (data == 0) {
				$('#search').attr('action', '{WEBURLPATH}/coupon.php');
			} else {
				$('#search').attr('action', '{WEBURLPATH}/company.php');
			}
			$('#search_type .option').removeClass('option-active');
			$(this).addClass('option-active');
			$('#type span').html(text);
			$('#type_id').val(data);
			$('#search_type').hide();
			
			getCategoryData(data);
		});
	});

	$('#search_area').find('.option').each(function(){
		$(this).click(function(){
			var text = $(this).html();
			text = text.replace(/(\[|\])/g, "");
			var data = $(this).attr('data-value');
			$('#search_area .option').removeClass('option-active');
			$(this).addClass('option-active');
			$('#area span').html(text);
			$('#area_id').val(data);
			$('#search_area').hide();
		});
	});

	function bindSearchCategory() {
		$('#search_category').find('.option').each(function(){
			$(this).click(function(){
				var text = $(this).html();
				text = text.replace(/(\[|\])/g, "");
				var data = $(this).attr('data-value');
				$('#search_category .option').removeClass('option-active');
				$(this).addClass('option-active');
				$('#category span').html(text);
				$('#category_id').val(data);
				$('#search_category').hide();
			});
		});
		$('#category span').html('全部分类');
		$('#category_id').val(0);
	}
	bindSearchCategory();

	$('.close').click(function(){
		$(this).parent().hide();
	});
	$(document).click(function(event){
		var target = $(event.target);
		if (target.parents("#showsearch").length == 0) {
			$('.pop-panel').hide();
		}
	});
});
function switchHotCoupon(obj, type) {
	$('.hotCoupon .cont').hide();
	$('.hotCoupon ul li').removeClass('current');
	var id = 'hotCoupon_' + type;
	$('#'+id).show();
	$(obj).parent().addClass('current');
}
</script>
<div id="noticeBox">
	<div class="left">
		<span>站内公告：</span>
		<marquee behavior="scroll" direction="left" scrollamount="4" onmouseover="this.stop()" onmouseout="this.start()">
			{loop $webglobal['file_index']['notice'] $key $value}
				{$value['autoindex']}.{$value['textlink']}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			{/loop}
		</marquee>
	</div>
	<div class="right" id="showsearch">
		<form name="search" id="search" method="post" action="{WEBURLPATH}/coupon.php">
			<a class="searchA" id="type" style="width:60px;"><span style="width:51px;">优惠券</span><input id="type_id" type="hidden" value="1" /></a>
			{if $webglobal['file_index']['areadata']}
			<a class="searchA" id="area" style="width:80px;"><span style="width:80px;">所有地区</span><input id="area_id" type="hidden" name="a" value="" /></a>
			{/if}
			<a class="searchA" id="category" style="width:80px;"><span style="width:80px;">全部分类</span><input id="category_id" type="hidden" name="c" value="" /></a>
			<input class="txtIpt" type="text" name="s" value="" />
			<input class="btnIpt" type="submit" value="" />
		</form>
		
		<ul id="search_type" class="pop-panel ep_quick-search ep_quick-search-channels">
			<li><a class="option option-active" href="#" data-value="1">优惠劵</a></li>
			<li><a class="option" href="#" data-value="2">商铺</a></li>
		</ul>
		
		{if $webglobal['file_index']['areadata']}
		<div id="search_area" class="pop-panel ep_quick-search">
			<div class="dp-option-wrap">
				<div class="default">
					<a class="option option-active" data-value="0">[所有地区]</a>	
				</div>
				<!-- <ul class="list-term">
					<li><a class="option" href="#" data-value="1484">[茶馆]</a></li>
					<li><a class="option" href="#" data-value="447">[粤菜]</a></li>
					<li><a class="option" href="#" data-value="453">[新疆/清真]</a></li>
					<li><a class="option" href="#" data-value="457">[烧烤]</a></li>
					<li><a class="option" href="#" data-value="458">[海鲜]</a></li>
					<li><a class="option" href="#" data-value="471">[东南亚菜]</a></li>
					<li><a class="option" href="#" data-value="461">[自助餐]</a></li>
				</ul> -->
				{loop $webglobal['file_index']['areadata'] $areaid $area}
				<dl>
					<dt><a class="option" href="#" data-value="{$areaid}">[{$area[name]}]</a></dt>
					<dd>
						<ul class="list-desc">
							{loop $area['second'] $subareaid $subarea}
							<li><a class="option" href="#" data-value="{$subareaid}">$subarea[name]</a></li>
							{/loop}
						</ul>
					</dd>
				</dl>
				{/loop}
			</div>
			<a class="close" title="关闭" href="javascript:void(0)">关闭</a>
		</div>
		{/if}
		<div id="search_category" class="pop-panel ep_quick-search">
			<div class="dp-option-wrap">
				<div class="default">
					<a class="option option-active" data-value="0">[全部分类]</a>
				</div>
				
				{loop $webglobal['file_index']['couponCategory'] $cid $couponCategory}
				<dl>
				<dt><a class="option" href="#" data-value="{$cid}">[{$couponCategory[name]}]</a></dt>
				<dd>
					<ul class="list-desc">
						{loop $couponCategory['cell'] $subcid $subCouponCategory}
						<li><a class="option" href="#" data-value="{$subcid}">{$subCouponCategory[name]}</a></li>
						{/loop}
					</ul>
				</dd>
				</dl>
				{/loop}
				</dl>
			</div>
			<a class="close" title="关闭" href="javascript:void(0)">关闭</a>
		</div>
	</div>
</div>

<div id="companySortBox">
	<dl>
		<dt><a href="#">全部商户</a></dt>
		<dd>
			
			<ul class="leftNav">
				{loop $webglobal[companyCategory] $cid $category}
					<li>
						<a href="{WEBURLPATH}/company.php?c={$cid}">$category[name]</a>
						<ul class="leftSubNav">
							{if ($category[second] && $category[second])}
							{loop $category[second] $subid $subcategory}
							<li><a href="{WEBURLPATH}/company.php?c={$subid}">{$subcategory[name]}</a></li>
							{/loop}
							{/if}
						</ul>
					</li>
				{/loop}
			</ul>
		</dd>
	</dl>
</div>

<div class="topContMid">
	{template showpic}
	<div id="hotnewsBox">
		<ul>
			{loop $webglobal['file_index']['hotnews'] $news}
				<li><a href="{$news['typeurl']}">[{$news[tp_name]}]</a><a href="{$news['arcurl']}">{$news[title]}</a></li>
			{/loop}
		</ul>
	</div>
</div>
<div class="topContRight">
	<div id="loginBox">
		<ul id="loginNav">
			<li id="personal" class="current"><a href="javascript:void(0)" onclick="$('#login_user_type').val(0);$('#company').attr('class','');$('#personal').attr('class','current');$('#login_findpass').attr('href','{WEBURLPATH}/login.php?action=findpass');$('#login_register').attr('href','{WEBURLPATH}/register.php');">个人用户</a></li>
			<li id="company"><a href="javascript:void(0)" onclick="$('#login_user_type').val(1);$('#personal').attr('class','');$('#company').attr('class','current');$('#login_findpass').attr('href','{WEBURLPATH}/login.php?action=comfindpass');$('#login_register').attr('href','{WEBURLPATH}/register.php?action=regcom');">商家</a></li>
		</ul>
		<form method="post" name="loginform" onsubmit="checkpass()" id="loginform" action="{WEBURLPATH}/login.php?check">
		<input type="hidden" name="user_type" id="login_user_type" value="0" />
		<label>
			<span>邮箱：</span><input class="txtIpt" type="text" name="username" />
		</label>
		<div style="height:5px"></div>
		<label><span>密码：</span><input class="txtIpt" id="password" type="password" name="password" /><a id="login_findpass" class="forgetPwdA" href="{WEBURLPATH}/login.php?action=findpass" title="忘记密码了？"></a></label><div style="height:5px"></div>
		<label id="chkLabel"><input class="chkIpt" type="checkbox" name="remember" value="1" />记住我</label>
		<label id="subLabel"><input class="btnIpt" type="submit" value="" /><a id="login_register" href="{WEBURLPATH}/register.php" title="免费注册">免费注册</a></label>
		</form>
	</div>
	<div id="loginedBox" class="latestCompany" style="margin: 5px 0 10px 0;display:none;">
		<div class="tit"><a href="#" class="left">功能菜单</a></div>
		<div class="cont" style="height: 139px;"><div id="indexUser"></div></div>
	</div>
	<div class="topRightProBoxa"><img src="{WEBURLPATH}/images/toprightproa.gif" alt="" /></div>
	<div class="topRightProBoxb">
		<!--{if $webglobal['file_index']['starCompany']}-->
			<!--{if $webglobal['file_index']['starCompany']['logo'] != ''}-->
				<a href="{WEBURLPATH}/company.php?action=view&id={$webglobal['file_index']['starCompany']['id']}"><img src="{WEBURLPATH}{$webglobal['file_index']['starCompany']['star']}" alt="{$webglobal['file_index']['starCompany']['name']}" /></a>
			<!--{else}-->
				<a href="{WEBURLPATH}/company.php?action=view&id={$webglobal['file_index']['starCompany']['id']}"><img src="{WEBURLPATH}{$webglobal['file_index']['starCompany']['thumbnail']['middle']}" alt="{$webglobal['file_index']['starCompany']['name']}" /></a>
			<!--{/if}-->
		<!--{/if}-->
		<!-- <div id="flashPic">
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="215" height="129">
			  <param name="movie" value="{WEBURLPATH}/images/flashpic.swf" />
			  <param name="quality" value="high" />
			  <param name="WMode" value="Transparent">
			  <embed src="{WEBURLPATH}/images/flashpic.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="215" height="129" wmode="transparent" ></embed>
			</object>
		</div> -->
	</div>
</div>
<div class="latestCoupon">
	<div class="couponSortList">
		<a href="#">美食</a>
		<a href="#">服装</a>
		<a href="#">KTV</a>
		<a href="#">美容</a>
		<a href="#">婚纱</a>
		<a href="#">家居</a>
		<a href="#">雅思</a>
		<a href="#">宠物</a>
		<a class="more" href="{WEBURLPATH}/coupon.php"></a>
	</div>
	<div class="couponSort">
		<!-- <div class="blocktitle"><strong>优惠券分类a</strong><span></span></div> -->
		<ul>
			{loop $webcache[newcoupon][1] $couponkey $coupon}
			<li>
				<a href="{WEBURLPATH}/coupon.php?action=view&id={$coupon[id]}" class="img"><img src="{WEBURLPATH}{if $coupon[image] != ''}{$coupon[thumbnail][middle]}{else}images/nopic-big.png{/if}" alt="{$coupon[name]}" title="{$coupon[name]}" /></a>
				<a href="{WEBURLPATH}/coupon.php?action=view&id={$coupon[id]}" class="tit" title="{$coupon[name]}">{$coupon[name]}</a>
				<span class="priceBefore">折前￥{$coupon[original]}</span>
				<span class="priceAfter">{$coupon[price]}</span>
			</li>
			{/loop}
		</ul>
	</div>
	<div class="couponSort">
		<!-- <div class="blocktitle"><strong>优惠券分类b</strong><span></span></div> -->
		<ul>
			{loop $webcache[newcoupon][2] $couponkey $coupon}
			<li>
				<a href="{WEBURLPATH}/coupon.php?action=view&id={$coupon[id]}" class="img"><img src="{WEBURLPATH}{if $coupon[image] != ''}{$coupon[thumbnail][middle]}{else}images/nopic-big.png{/if}" alt="" /></a>
				<a href="" class="tit" title="{$coupon[name]}">{$coupon[name]}</a>
				<span class="priceBefore">折前￥{$coupon[original]}</span>
				<span class="priceAfter">{$coupon[price]}</span>
			</li>
			{/loop}
		</ul>
	</div>
</div>
<div class="hotCoupon">
	<div class="tit">
		<a href="javascript:void(0)" class="left">热门优惠券</a>
		<ul>
			<li class="current"><a href="javascript:void(0)" onclick = "javascript:switchHotCoupon(this, 'day');">日</a></li>
			<li><a href="javascript:void(0)" onclick = "javascript:switchHotCoupon(this, 'week');">周</a></li>
			<li><a href="javascript:void(0)" onclick = "javascript:switchHotCoupon(this, 'month');">月</a></li>
		</ul>
	</div>
	<ul class="cont" id="hotCoupon_day">
		{loop $webcache[hotcoupon][day] $couponid $coupon}
		<li>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="img"><img src="{WEBURLPATH}{if $coupon[image] != ''}{$coupon[thumbnail][small]}{else}/images/nopic-small.png{/if}" alt="" /></a>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="tit" title="{$coupon[name]}">{$coupon[name]}</a>
			<span class="couponTit" title="">￥{$coupon[price]}元</span>
			<span class="price">原价：￥{$coupon[original]}<br />折扣：{$coupon[discount]}折</span>
		</li>
		{/loop}
	</ul>
	<ul class="cont" id="hotCoupon_week" style="display:none">
		{loop $webcache[hotcoupon][week] $couponid $coupon}
		<li>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="img"><img src="{WEBURLPATH}{if $coupon[image] != ''}{$coupon[thumbnail][small]}{else}/images/nopic-small.png{/if}" alt="" /></a>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="tit" title="{$coupon[name]}">{$coupon[name]}</a>
			<span class="couponTit" title="">￥{$coupon[price]}元</span>
			<span class="price">原价：￥{$coupon[original]}<br />折扣：{$coupon[discount]}折</span>
		</li>
		{/loop}
	</ul>
	<ul class="cont" id="hotCoupon_month" style="display:none">
		{loop $webcache[hotcoupon][month] $couponid $coupon}
		<li>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="img"><img src="{WEBURLPATH}{if $coupon[image] != ''}{$coupon[thumbnail][small]}{else}/images/nopic-small.png{/if}" alt="" /></a>
			<a href="{WEBURLPATH}/coupon.php?action=view&id={$couponid}" class="tit" title="{$coupon[name]}">{$coupon[name]}</a>
			<span class="couponTit" title="">￥{$coupon[price]}元</span>
			<span class="price">原价：￥{$coupon[original]}<br />折扣：{$coupon[discount]}折</span>
		</li>
		{/loop}
	</ul>
</div>
<div class="midProBox"><img src="{WEBURLPATH}/images/ad03.jpg" alt="" /></div>
<div class="hotNewsBox">
	{loop $webglobal['file_index']['typeimage'] $typeimage}
		<div>
			<a href="{$typeimage['arcurl']}"><img style="float:left;width:70px;height:70px;border:1px #ddd solid;padding:2px;" src="{$typeimage['litpic']}" /></a>
			<span style="float:left;margin:0px 0px 0px 10px;display:block;width:260px;"><a href="{$typeimage['arcurl']}">{$typeimage['title']}</a></span>
			<p style="float:left;margin:5px 0px 0px 10px;width:260px;">{$typeimage['info']}</p>
		</div>
	{/loop}
		<style>
		.hotnewsul{clear:both;padding:6px 0px 0px 0px;}
		.hotnewsul a{float:left;display:inline-block;margin:0px 5px 0px 2px;cursor:pointer;line-height:23px;}
		.hotnewsul a.sort{color:#666;}
		.hotnewsul a.news{
		width:120px;
		color:#666;
		word-break:keep-all;
		white-space:nowrap;
		overflow:hidden;
		text-overflow:ellipsis;
		}
		</style>
		
			{loop $webglobal['file_index']['channelartlist'] $channel}<div class="hotnewsul">
				<a class="sort" href="{$channel['typeurl']}">[{$channel['typename']}]</a>
				{loop $channel['list'] $news}
				<a class="news" href="{$news['arcurl']}">{$news['shorttitle']}</a>
				{/loop}</div>
			{/loop}
		
	
</div>
<ul class="checkInBox">
	{loop $webglobal['file_companyComment'] $id $tempdata}
	<li>
	<a style="margin-top:5px;margin-right:5px;border:1px #ddd solid;padding:2px;" href="{WEBURLPATH}/company.php?action=view&id={$tempdata[companyid]}" class="img">
	{if $tempdata[avatar] !=''}
		<img width="72" height="72" src="{WEBURLPATH}{$tempdata[avatar]}" alt="" />
	{else}
		<img width="72" height="72" src="{WEBURLPATH}/images/dfboy.png" />
	{/if}
	</a>
	<!-- <span class="tit" style="width:250px;" title="{$tempdata[personname]}">{$tempdata[personname]}</span> -->
	<span class="abstract" style="float:left;width:250px;">{$tempdata[personname]}&nbsp;&nbsp;在&nbsp;&nbsp;<a href="{WEBURLPATH}/company.php?action=view&id={$tempdata[companyid]}">{$tempdata[companyname]}</a>&nbsp;&nbsp;签到
	<br />签到时间：{$tempdata[addtime]}</span>
	<span class="mark" style="width:250px;">
		<img src="{WEBURLPATH}/images/mark{$tempdata[score]}.gif" alt="3分" />
		<br/>{$tempdata[inquiry_title]}:&nbsp;&nbsp;&nbsp;<em>{$tempdata[inquiry_result]}</em>
	</span>
	</li>
	{/loop}
</ul>
<div class="latestCompany">
	<div class="tit"><a href="#" class="left">最新商户</a></div>
	<ul class="cont">
		{loop $webcache[newcompany] $companyid $company}
			<li>
				<a href="{WEBURLPATH}/company.php?action=view&id={$company[id]}" class="img">
				<img src="{WEBURLPATH}{if $company[logo] != ''}{$company[logo_thumbnail][small]}{else}/images/noavatar-big.jpg{/if}" alt="" />
				</a>
				<a href="{WEBURLPATH}/company.php?action=view&id={$company[id]}" class="list">{$company[name]}</a>
				<a href="{WEBURLPATH}/company.php?action=view&id={$company[id]}" class="list">{$company[english_name]}</a>
			</li>
		{/loop}
	</ul>
</div>

{template footer}